#include <iostream>   
#include <cstdlib>

#include "doublelinklist.h"


List < int >:: iterator find(List < int >& _list , int _val )
 {
    for (List<int>::Node* it = _list.head->next ; it->next != nullptr; it = it->next )
    {
    if (it->data == _val)
    {
        std::cout<<_val<<" is found successfully!"<<std::endl;
        return List< int >:: iterator(it);}
    }
    std::cout<<_val<<" is not found..."<<std::endl;
    return _list.end();
 };


int main()
{
    List<int> doublelink;
    doublelink.push_back(1);
    doublelink.push_back(2);
    doublelink.push_back(3);
    doublelink.push_back(4);
    doublelink.push_back(5);
    doublelink.printList();
    List<int>::iterator  iter = find(doublelink,3);
    doublelink.erase(iter);
    doublelink.printList();
    find(doublelink,3);
    
    
    return 0;
};
